package com.woniu.service.impl;

import com.woniu.dto.AppliDto;
import com.woniu.entity.InpatientApplication;
import com.woniu.mapper.InpatientApplicationMapper;
import com.woniu.service.InpatientApplicationService;
import com.woniu.utils.ResponseEnum;
import com.woniu.utils.ResponseUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @Author: zcy
 * @Create: 2025/10/31 15:34
 */
@Service
public class InpatientApplicationServiceImpl implements InpatientApplicationService {
    @Resource
    private InpatientApplicationMapper inpatientApplicationMapper;
    @Override
    public ResponseUtil add(AppliDto appliDto) {
        InpatientApplication inpatientApplication = new InpatientApplication();
        inpatientApplication.setIaCaseid(appliDto.getPatientId());
        inpatientApplication.setIaWorkerid(appliDto.getSid());
        inpatientApplication.setIaDepartmentid(appliDto.getRoomId());
        inpatientApplication.setIaStatus("0");
        inpatientApplication.setIaDate(new Date(System.currentTimeMillis()));
        int insert = inpatientApplicationMapper.insert(inpatientApplication);

        return insert > 0 ? ResponseUtil.get(ResponseEnum.OK): ResponseUtil.get(ResponseEnum.FAIL);

    }
}
